package org.service.es.entity;

import lombok.Data;
import org.dromara.easyes.annotation.HighLight;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;

import java.util.List;

/**
 * ES数据模型
 * <p>
 * Copyright © 2021 xpc1024 All Rights Reserved
 **/
@Data
@IndexName("super_article_bean")
public class EsSuperArticleBean {

    /**
     * es中的唯一id
     */
    @IndexId(type = IdType.CUSTOMIZE)
    private String beanId;
    /**
     * Es 实体类型
     * 1.资讯 real_time_info
     * 2.分栏资讯
     * 3.法规文献
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer beanType;
    /**
     * 数据库中的id
     * beanType =1 时 为 realId
     */
    @IndexField(fieldType = FieldType.LONG)
    private Long originId;
    /**
     * 模块ID
     */
    @IndexField(fieldType = FieldType.LONG)
    private Long pageIndexId;

    /**
     * 标题
     */
//    @MultiField(
//            mainField = @IndexField(fieldType = FieldType.TEXT, analyzer = "ik_max_word"),
//            otherFields = {@InnerField(suffix = "standard", fieldType = FieldType.TEXT, analyzer = "standard")
//            })
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_MAX_WORD)
    @HighLight(mappingField = "titleHighlight")
    private String title;

    private String titleHighlight;

    /**
     * 子标题
     */
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_MAX_WORD, searchAnalyzer = Analyzer.IK_MAX_WORD)
    @HighLight(mappingField = "subTitleHighlight")
    private String subTitle;

    @IndexField(exist = false)
    private String subTitleHighlight;

    /**
     * 内容
     */
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_MAX_WORD, searchAnalyzer = Analyzer.IK_MAX_WORD)
    @HighLight(mappingField = "contentHighlight")
    private String content;

    @IndexField(exist = false)
    private String contentHighlight;

    /**
     * 创建时间
     */
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private String createTime;
    /**
     * 发布时间
     */
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private String releaseTime;
    /**
     * 更新时间
     */
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private String updateTime;
    /**
     * 来源
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String source;
    /**
     * 图片链接
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String img;
    /**
     * 时评链接
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String video;
    /**
     * 编辑者的姓名
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String editedName;
    /**
     * 创建人
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String createName;
    /**
     * 状态
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer status;
    /**
     * 更多展示样式 1- 仅文字样式 2- 左边图样式 3- 上方图片样式 4 视频样式
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer showStyles;
    /**
     * 列表展示样式
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer fewStyles;
    /**
     * parent id
     */
    @IndexField(fieldType = FieldType.LONG)
    private Long parentId;
    /**
     * 原始类型
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer originType;
    /**
     * 用户组
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private List<Integer> userGroup;
    /**
     * 位置
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private List<String> location;

    @IndexField(fieldType = FieldType.LONG)
    private Long hotCount;
    /**
     * 法规的内容
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String literatureContent;
    /**
     * 媒资类型
     */
    @IndexField(exist = false)
    private String xtype;
    /**
     * 媒资文章视频类型
     */
    @IndexField(exist = false)
    private String type;

}
